package com.qingcloud.df.executor.launcher;

import com.qingcloud.df.executor.service.TaskService;
import com.qingcloud.df.sdk.component.context.CompInstContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Resource;

public class TaskLauncher  implements Launcher {
    Logger log =  LoggerFactory.getLogger(TaskLauncher.class);

    @Resource
    TaskService taskService;
    @Override
    public void start(CompInstContext context) throws Exception {
        if(context.getTaskId() !=null )
            taskService.enableJob(context.getTaskId());
    }
    @Override
    public void stop(CompInstContext context) throws Exception {
        //停止定时任务
        if(context.getTaskId() !=null )
            taskService.disableJob(context.getTaskId());
    }
}
